import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    redirect:'/home'
  },
  {
    naem:'Home',
    path:'/home',
    component:()=>import('@/views/Home.vue'),
    children:[
      {
        path:'/home',
        redirect:'/home/new'
      },
      {
        path:'new',
        meta:{
          title:"Card(猫说)"
        },
        component:()=>import('@/views/new.vue')
      },
      {
        path:'picLook',
        component:()=>import('@/views/picLook.vue'),
        children:[
          {
            path:'/home/picLook',
            redirect:"/home/picLook/pic-new"
          },
          {
            path:'pic-new',
            meta:{
              title:"Card(猫说)-图说 "
            },
            component:()=>import('@/pages/pic-new.vue')
          },
          {
            path:'pic-hot',
            component:()=>import('@/pages/pic-hot.vue')
          },
          {
            path:'pic-mile',
            component:()=>import('@/pages/pic-mile.vue')
          }
        ]
      },
      {
        path:'raise',
        component:()=>import('@/views/raise.vue'),
        children:[
          {
            path:'/home/raise',
            redirect:'/home/raise/raise-task'
          },
          {
            path:"raise-task",
            meta:{
              title:"Card(猫说)-养鹅 "
            },
            component:()=>import("@/pages/raise-task.vue")
          },
          {
            path:"raise-raising",
            component:()=>import("@/pages/raise-raising.vue")
          },
          {
            path:"raise-market",
            component:()=>import("@/pages/raise-market.vue")
          },
          {
            path:"raise-wallet",
            component:()=>import("@/pages/raise-wallet.vue")
          },
        ]
      },
      {
        path:'find',
        meta:{
          title:"Card(猫说)-发现 "
        },
        component:()=>import('@/views/find.vue'),
      },
      {
        path:'mine',
        meta:{
          title:"Card(猫说)-我的 "
        },
        component:()=>import('@/views/mine.vue'),
      }
    ]
  },
  {
    name:"Card-read",
    path:'/card-read/:id',
    component:()=>import('@/pages/card-read.vue')
  },
  {
    name:"Comment",
    path:"/comment",
    component:()=>import("@/pages/comment.vue")
  },
  {
    name:"myCollection",
    path:'/myCollection',
    component:()=>import('@/pages/myCollection.vue')
  }

]

const router = new VueRouter({
  routes,
  // linkActiveClass:"active",
  linkExactActiveClass:'active',
  
})

// router.beforeEach((to, from, next)=>{
//   if(to.meta.title){
//     document.title = to.meta.title
//   }
//   next()
// })

export default router
